<script setup lang="ts">
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { ID } from '#/api/common';

import { onMounted } from 'vue';
import { useRoute } from 'vue-router';

import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { consumerClient } from '#/api/iot/relay/consumerGroup/index';

import { columns } from './data';

const route = useRoute();
const groupId = route.params.id;
const gridOptions: VxeGridProps = {
  columns,
  height: '500',
  toolbarConfig: {
    enabled: false,
  },
  pagerConfig: {
    enabled: false,
  },
  proxyConfig: {
    ajax: {
      query: async (_) => {
        const resp = await consumerClient(groupId as ID);
        return { rows: resp };
      },
    },
  },
  /**
   * 虚拟滚动  默认关闭
   */
  scrollY: {
    enabled: false,
    gt: 0,
  },
  id: 'online-client-index',
};

const [BasicTable] = useVbenVxeGrid({
  gridOptions,
});

onMounted(() => {});
</script>

<template>
  <BasicTable />
</template>
<style lang="scss" scoped></style>
